package com.zhangjm.dao;

import com.zhangjm.pojo.House;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;

import java.math.BigDecimal;

public interface HouseDao extends JpaRepository<House, Integer> {

    /*
        根据省份查找
     */
    Page<House> findByProvince(Integer pid , Pageable pageable);

    /**
     * 根据几室查找
     * @param room
     * @param pageable
     * @return
     */
    Page<House> findByRoom(Integer room, Pageable pageable);

    /**
     * 根据大于几室查找
     * @param room
     * @param pageable
     * @return
     */
    Page<House> findByRoomGreaterThanEqual(Integer room, Pageable pageable);


    /**
     * 根据租金查询
     * @param srent
     * @param erent
     * @param pageable
     * @return
     */
    Page<House> findByRentGreaterThanEqualAndRentLessThanEqual(BigDecimal srent, BigDecimal erent, Pageable pageable);


    Page<House> findByRentGreaterThanEqualAndRentLessThanEqualAndRoomAndProvince(BigDecimal srent, BigDecimal erent, Integer room, Integer pid, Pageable pageable);

}
